import { createApp } from 'vue'

import App from './App.vue'
import { router } from './router/index'
// 引入elementplus图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// 全局组件通信
import mitt from 'mitt'

import 'element-plus/dist/index.css'
import './style.css'

// 引入状态管理库
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(router)
app.config.globalProperties.$bus = mitt()
app.mount('#app')
app.use(pinia)

export default app
